const mysql = require('mysql');

/**
 * 连接对象
 * @type {Connection}
 */
let connection = mysql.createConnection({
    host: '192.168.0.108',
    port: '3306',
    user: 'root',
    password: '123456',//修改为自己的密码
    database: 'test'//修改为自己的数据库
});
// 初始化连接
connection.connect(err => {
    if (err) {
        console.error("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Error:"+ err.message);
    }
    console.log('mysql connncted success!');
});
exports.connection = connection;

//查询对象
exports.query = function query(qs, callback) {
    return connection.query(qs, callback);
};
